#include "../source/task.hh"
#include "../source/queue.hh"
#include "../source/cpmodel.hh"

using namespace cloud;

void test_cb()
{
    std::cout << "-----------" << std::endl;
}

void test_queue()
{
    task::ptr ct = task_factory::create<cb_task>(&test_cb);
    (*ct)();

    loop_queue<task::ptr> q;
    q.push(ct);

    task::ptr popt;
    q.pop(popt);

    (*popt)();
}

void test_cp_model()
{
    task::ptr ct = task_factory::create<cb_task>(&test_cb);

    cp_model::instance().push(ct);

    while (true)
    {
        std::this_thread::sleep_for(std::chrono::milliseconds(100));
    }
}

#define TEST \
                2

int main()
{
    switch (TEST)
    {
    case 1: test_queue(); break;
    case 2: test_cp_model(); break;
    }

    return 0;
}
